import { PartialType, PickType } from '@nestjs/mapped-types';
import { ApiProperty } from '@nestjs/swagger';
import { IsEnum, IsOptional } from 'class-validator';
import { Gender, User } from '../schemas/user.schema';

// export class UpdateUserDto extends PartialType(CreateUserDto) {}
// export class UpdateUserDto extends PartialType(
//     PickType(User, ['phone', 'avatar', 'nickname', 'desc', 'gender', 'birthday'] as const)
// ) {}

export class UpdateUserDto {
    @ApiProperty()
    @IsOptional()
    phone?: string;

    @ApiProperty()
    @IsOptional()
    nickname?: string;

    @ApiProperty()
    @IsOptional()
    desc?: string;

    @ApiProperty()
    @IsEnum(Gender)
    @IsOptional()
    gender?: Gender;

    @ApiProperty()
    @IsOptional()
    birthday?: Date;

    @ApiProperty()
    @IsOptional()
    avatar?: string;
}
